package ru.incoremedia.gwttest.core.server.listener;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletRequest;
import ru.incoremedia.gwttest.core.server.context.RequestContext;


public class RequestContextListener implements ServletRequestListener {

    @Override
    public void requestDestroyed(ServletRequestEvent sre) {
        RequestContext.getInstance().setRequest(null);
    }

    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        RequestContext.getInstance().setRequest((HttpServletRequest)sre.getServletRequest());
    }

}
